In [27]:
from clifford import * #from https://bitbucket.org/robertkern/clifford
pretty()
layout, blades = Cl(3,1)
rb = lambda g:randomMV(layout, grades=[g])
Vectors in the orignal space are mapped to vectors in conformal space through the map:
$X = x + \frac{1}{2} x^2 e_{\infty} +e_o $
The inverse map is the made by normalizing the conformal vector, then rejection from the minkowski plane $E_0$,
$ X = \frac{X}{X \cdot e_{\infty}}$
then
$x = X \wedge E_0\, E_0^{-1}$
In [28]:
e0,e1,e2,e3 = [blades['e%i'%k] for k in range(4)]
# setup null basis, and minkowski subspace bivector
eo = .5^(e3-e2)
einf= e2+e3
E0= einf^eo
v4 = lambda : rb(1)
def v2():
x=v4()
return x- E0.project(x)
up = lambda x: x + (.5^((x**2)&einf)) + eo
homo = lambda x: x & (-x*einf).normalInv()
down = lambda x: (homo(x)^E0)&E0
c2v = lambda x: (x.real&e0) + (x.imag&e1) # complex2vector
v2c = lambda x: float(x*e0)+ float(x*e1)*1j
In [29]:
eo^einf == -E0
Out[29]:
In [30]:
einf&eo
Out[30]:
In [31]:
einf-(2^eo)
Out[31]:
In [32]:
x = v2()
x
Out[32]:
In [33]:
X=up(x)
X
Out[33]:
In [34]:
x = v2()
X = up(x)
assert(X**2 ==0)
assert(down(X) ==x)
Conformal transformations in $G^n$ are achieved through versers in the conformal space $G^{n+1,1}$. These versers can be categorized by their relation to the minkowski plane, $E_0$. There are three categories,
In [35]:
from IPython.display import Image,SVG
Image('pics/conformal space.png')
Out[35]:
In [36]:
eps(1e-13)
a = v2()
b = v2()
$ e_+ X e_+$
Inversion is a reflection in hyperplane normal to $e_-$, this swaps $e_o$ and $e_{\infty}$
In [37]:
assert(down(e2&up(a)&e2) == a.inv())
$E_0 X E_0$
In [38]:
assert(down(E0&up(a)&E0) == -a)
$D_\alpha = e^{-\frac{\ln{\alpha}}{2} \,E_0} $
$D_\alpha \, X \, \tilde{D_\alpha} $
In [39]:
D = lambda alpha: e**((-log(alpha)/2.)&(E0))
alpha = rand()
assert(down( D(alpha)&up(a)&~D(alpha)) == (alpha&a))
In [40]:
T = lambda x: e**(1/2.&(einf&x))
assert(down( T(a)&up(b)&~T(a)) == b+a)
A transversion is an inversion, followed by a translation, followed by a inversion.
In [41]:
down(e2&T(b)&e2&up(a)&e2&~T(b)&e2) == 1/(b+1/a)
Out[41]:
Versers that are out of $E_0$ are made up of the versers within the original space. These include reflections and rotations, and their conformal representation is identical to their form in $G^n$
In [42]:
m = v2()
m = m/abs(m)
assert(down(m&up(a)&m) == -m&a&m)
In [43]:
R = lambda theta: e**((-.5*theta)&(e0^e1))
theta = pi/2
assert(down( R(theta)&up(a)&~R(theta)) == R(theta)&a&~R(theta))
In [44]:
a,b = v2(),v2()
down(up(a)&up(b))
Out[44]:
As a simple example consider the combination operations of translation,scaling, and inversion.
$b=-2a+e_0$
In [45]:
A = up(a)
Q = T(e0)&E0&D(2)
B = Q&A&~Q
assert(down(B) == (-2&a)+e0 )
A transversion may be built from a inversion, translation, and inversion.
$a^{'} = (a^{-1}+b)^{-1}$
In [46]:
A = up(a)
Q = e2&T(b)&e2
B = Q&A&~Q
assert(down(B) ==1/(1/a +b))
In [47]:
c=((1/a)+b)
c.rightInv??
$s = \frac{z-1}{z+1} = -1( 2(z+1)^{-1})+1$
Note that if z is interpreted as a spinor (complex number), then the spinor inversion translates to inversion + reflection about real axis.
In [83]:
z = v2()
Z = up(z)
Q = T(e0) & E0 & D(2)& e0 & e2 & T(e0)
S = Q&Z&~Q
s = down(S)
#assert(s == (z+e0).inv()&(z-e0))
s,e0&((z+e0).inv()&(z-e0))
Out[83]:
In [90]:
z_ = v2c(z)
(z_-1)/(z_+1)
Out[90]:
Rotation about a point, $a$ can be achieved by translating the origina to $a$ then rotating, then translating back. This composition of operations can also be thought of as translating the Rotor itself.
In [49]:
r = R(pi/2.)
Q =T(a)&r&~T(a)
B= up(b)
C=Q&B&~Q
c=down(C)
c
Out[49]:
$m = e_{00}+ e_{01}(a^{-1}-e_{11})^{-1}$
In [51]:
e11, e00, e01 = v2(),v2(),v2()
from math import atan
theta= atan((e01*e1)/(e01*e0))
Q = T(e00) & D(abs(e01)) & R(theta) & e2& T(e11) & e2
Q = D(abs(e01)) & R(theta)
A= up(a)
M = Q&A&~Q
m= down(m)
In [61]:
a,b
Out[61]:
In [62]:
A,B = up(a),up(b)
In [64]:
A&B
Out[64]:
In [66]:
a&b
Out[66]:
In [67]:
down(A&B)
Out[67]:
In [69]:
(a+b).inv(), a.inv()+b.inv()
Out[69]:
In [71]:
e0&(1/(a+b))&e0
Out[71]:
In [75]:
1/(a+b)
Out[75]:
In [74]:
a
Out[74]:
In [85]:
e0&a&e0&b, e0&b&e0&a
Out[85]:
In [87]:
a&e0&b
Out[87]:
In [ ]: